package com.example.hibernate.u.n1;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;

import org.hibernate.annotations.BatchSize;


@Entity
@SequenceGenerator(name="seq_dept", sequenceName="seq_dept")
//@BatchSize(size=5)
public class Department {
	
	private Long id;
	private String name;
	private Set<Employee> employees = new HashSet<Employee>();

	@OneToMany(mappedBy="dept", cascade={CascadeType.ALL})
	public Set<Employee> getEmployees() {
		return employees;
	}
	
	@Id @GeneratedValue(generator="seq_dept")
	public Long getId() {
		return id;
	}
	
	public String getName() {
		return name;
	}
	public void setEmployees(Set<Employee> employees) {
		this.employees = employees;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
}
